﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:props="clr-namespace:ScrumFactory.Team.Properties" >

    <Style x:Key="EventDescriptionTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding EventType}" Value="0">
                <Setter Property="TextBlock.Text" Value="{x:Static props:Resources.Project_start}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding EventType}" Value="1">
                <Setter Property="TextBlock.Text" Value="{Binding SprintNumber, StringFormat={x:Static props:Resources.Sprint_N_start}}"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding EventType}" Value="2">
                <Setter Property="TextBlock.Text" Value="{x:Static props:Resources.PProject_end}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="NoItemsTextBlock" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
        <Setter Property="Text" Value="{x:Static props:Resources.no_items}"/>
        <Setter Property="Foreground" Value="{StaticResource SubTextBrush}"/>
        <Setter Property="TextBlock.Visibility" Value="Collapsed"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding .}" Value="0">
                <Setter Property="TextBlock.Visibility" Value="Visible"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="MemberTasksListBox" TargetType="ListBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CustomFocusVisual}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource NoSelectionListBoxItem}"/>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid  Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}, AncestorLevel=1}, Path=ActualWidth}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="70" />
                            <ColumnDefinition Width="70" />
                        </Grid.ColumnDefinitions>

                        <Image Grid.Column="0" Style="{StaticResource TaskTypeImage}" DataContext="{Binding TaskType}"/>

                        <TextBlock Grid.Column="1" Margin="5,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="Wrap" >
                                    <Hyperlink Command="{Binding Model.ShowTaskDetailCommand, ElementName=thisView}" CommandParameter="{Binding .}" >
                                        <Run Text="{Binding TaskName}" />    
                                    </Hyperlink>
                                    <LineBreak/>
                                    <TextBlock Text="{Binding TaskInfo.ProjectName}" Foreground="{StaticResource SubTextBrush}" FontSize="{StaticResource SmallFontSize}" TextTrimming="CharacterEllipsis"/>
                                </TextBlock>

                        <TextBlock Grid.Column="2" Margin="10,0,0,0"
                                    HorizontalAlignment="Center"
                                     VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"
                                    Text="{Binding PlannedHours, StringFormat='{}{0} hrs'}" 
                                                Foreground="{StaticResource WatermarkTextBrush}" />

                        <TextBlock Grid.Column="3" Margin="10,0,0,0"
                                    HorizontalAlignment="Center"
                                     VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"
                                    Text="{Binding DaysOpened, StringFormat={x:Static props:Resources.N_days}}" 
                                                Foreground="{StaticResource WatermarkTextBrush}" />
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="MemberOwnedTasksListBox" TargetType="ListBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CustomFocusVisual}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource NoSelectionListBoxItem}"/>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}, AncestorLevel=1}, Path=ActualWidth}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="70"/>
                            <ColumnDefinition Width="70"/>
                        </Grid.ColumnDefinitions>

                        <Image Grid.Column="0" Style="{StaticResource TaskTypeImage}" DataContext="{Binding TaskType}"/>
                        <TextBlock Grid.Column="1" Margin="5,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="Wrap">
                            <Hyperlink Command="{Binding Model.ShowTaskDetailCommand, ElementName=thisView}" CommandParameter="{Binding .}">
                                <Run Text="{Binding TaskName}" />    
                            </Hyperlink>
                            <LineBreak/>
                            <TextBlock Text="{Binding TaskInfo.ProjectName}" Foreground="{StaticResource SubTextBrush}" FontSize="{StaticResource SmallFontSize}"/>                           
                        </TextBlock>

                        <TextBlock 
                            Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0" TextAlignment="Center" TextWrapping="Wrap"
                            Text="{Binding PlannedHours, StringFormat='{}{0} hrs'}" Foreground="{StaticResource WatermarkTextBrush}" />

                        <TextBlock 
                            Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0" TextAlignment="Center" TextWrapping="Wrap"
                            Text="{Binding DaysOpened, StringFormat={x:Static props:Resources.N_days}}" Foreground="{StaticResource WatermarkTextBrush}" />
                    </Grid>
                </DataTemplate>                
            </Setter.Value>
        </Setter>
    
    </Style>
    
    <Style x:Key="MemberEngagementListBox" TargetType="ListBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CustomFocusVisual}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource NoSelectionListBoxItem}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}, AncestorLevel=1}, Path=ActualWidth}"  />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">            
            <Setter.Value>                
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Width="450">
                        <Path                  
                                DockPanel.Dock="Right"
                                StrokeLineJoin="Round" SnapsToDevicePixels="True"
                                DataContext="{Binding ., Converter={StaticResource ProjectAllocationConverter}}"
                                Style="{StaticResource DayAllocationPath}"/>
                        <TextBlock Margin="10,0,0,0" TextTrimming="CharacterEllipsis">
                                <Hyperlink Command="{Binding Model.ShowProjectDetailCommand, ElementName=thisView}" CommandParameter="{Binding ProjectUId}">
                                    <Run Text="{Binding ProjectName}" />    
                                </Hyperlink>
                                <LineBreak/>
                                <TextBlock Text="{Binding ClientName}" Foreground="{StaticResource SubTextBrush}" FontSize="{StaticResource SmallFontSize}"/>
                            </TextBlock>
                    </StackPanel>
                </DataTemplate>                
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MemberWorkingWithListBox" TargetType="ListBox">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource CustomFocusVisual}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource NoSelectionListBoxItem}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal" Width="330" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Vertical" Width="80" Height="80">
                        <ContentControl Style="{StaticResource MemberImageControlStyle}" Width="45" Height="45" ToolTip="{Binding FullName}"/>
                        <TextBlock Text="{Binding MemberProfile.FullName}" 
                                                       FontSize="{StaticResource SmallFontSize}" Foreground="Black"
                                                       Margin="0,1,0,0" TextWrapping="Wrap" 
                                                       TextTrimming="CharacterEllipsis"  
                                                        TextAlignment="Center"
                                                       HorizontalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>